/*  J
**  Date 2007-05-21 23:53:31 
**  File mem.h  v 1.0
**  Author Mucker
**  See Copyright Notice in J.h
**  
*/
#ifndef mem_h
#define mem_h

#include "J.h"
#define Mmalloc(ss) \
	(mem_realloc(NULL, 0, ss))
#define Mnvector(n, t) \
	(mem_realloc(NULL, 0, n*sizeof(t)))
#define Mrnvector(ptr,old, n, t) \
	(mem_realloc(ptr, old, n*sizeof(t)))
#define Mnewvector(tt) \
	( mem_realloc(NULL, 0, sizeof(tt)) )
#define Mgrow_vector(ptr, used, osize, t, limit, msg) \
	{ if(used+1 > osize) \
	ptr = cast(t*, _growvector(ptr, &osize, sizeof(t), limit, msg)); }

J_API(void) *mem_realloc(void *ptr, size_t osize, size_t nsize);
J_API(void) mem_free(void *ptr);
J_API(void *) _growvector(void *ptr, size_t *osize, size_t ofsize, 
                  size_t limit,char *errormsg); 
#endif
